// Created by carolsail

import { ENUM_AUDIO_CLIP, ENUM_GAME_STATUS, ENUM_UI_TYPE } from "../Enum";
import { StaticInstance } from './../StaticInstance';
import AudioManager from "../manager/AudioManager";
import BaseLayer from "./Baselayer";
import DataManager from "../manager/DataManager";
import SdkManager from "../manager/SdkManager";
import { privacyChannel } from "../Script/privacyChannel";
import { privacyChannelKS } from "../Script/privacyChannelKS";

const { ccclass, property } = cc._decorator;

@ccclass
export default class DesktopLayer extends BaseLayer {
    button: cc.Node = null;
    btnClose: cc.Node = null;
    gameName: cc.Node = null
    protected onLoad(): void {
        this.btnClose = cc.find('Canvas/UI/DesktopLayer/style/panel/close')
        this.btnClose.on('click', this.onCloseClick, this)
        this.button = cc.find("Canvas/UI/DesktopLayer/style/panel/button")
        this.button.on('click', this.addShortCut, this)
        this.gameName = cc.find("Canvas/UI/DesktopLayer/style/panel/bottom/gameicon/label")

    }
    show(): void {
        super.show()


    }
    addShortCut() {
        AudioManager.instance.playSound(ENUM_AUDIO_CLIP.CLICK);
        (privacyChannel.getChannel() as privacyChannelKS).addShortcut()



    }
    onCloseClick() {
        AudioManager.instance.playSound(ENUM_AUDIO_CLIP.CLICK)
        StaticInstance.uiManager.toggle(ENUM_UI_TYPE.Desktop, false)
        StaticInstance.uiManager.toggle(ENUM_UI_TYPE.MENU)
    }

}
